<?php
    require('qcubed.inc.php');




    class ExampleForm extends QForm {
        protected $flaSample;

        protected $lblMessage;
        protected $btnButton;

        protected function Form_Create() {
            // Define the sample QFileAssset control -- make it required to show off validation
            $this->flaSample = new QeFileAsset($this);
            $this->flaSample->Required = true;
           // $this->flaSample->File = "phpX4bawO5357.ods";
            $this->flaSample->TemporaryUploadPath = __DOCROOT__ .__APPS__ . '/attach';
            $this->flaSample->ClickToView = false;


            // Add Styling
            $this->flaSample->CssClass = 'file_asset';
            $this->flaSample->imgFileIcon->CssClass = 'file_asset_icon';

                
            $this->lblMessage = new QLabel($this);
            $this->lblMessage->Text = 'Click on the button to change this message.';

            // The "Form Submit" Button -- notice how the form is being submitted via AJAX, even though we are handling
            // File Uploads on the form.
            $this->btnButton = new QButton($this);
            $this->btnButton->Text = 'Click Me';
            $this->btnButton->AddAction(new QClickEvent(), new QAjaxAction('btnButton_Click'));
            $this->btnButton->CausesValidation = true;
        }

        protected function btnButton_Click($strFormId, $strControlId, $strParameter) {
            $this->flaSample->File = "phpcQAwYQ3590.ods";
       
        }
    }
    // And now run our defined form
    ExampleForm::Run('ExampleForm', 'index.tpl.php');
?>
